package com.collect.cameroon.zhiAdater.zhiLevelDetail;

import android.text.TextUtils;
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.collect.cameroon.R;

public class ZHILevelWalletMobileAdjuster extends BaseQuickAdapter<String, BaseViewHolder> {

    public ZHILevelWalletMobileAdjuster() {
        super(R.layout.item_level_wallet_mobile_list, null);
    }

    private OnZHILevelWalletMobileAdjuster mOnZHILevelDetailAdjuster;

    @Override
    protected void convert(BaseViewHolder helper, String item) {
        helper.setText(R.id.tv_wallet_mobile, item);

        TextView tv_wallet_mobile = helper.getView(R.id.tv_wallet_mobile);
        ImageView iv_wallet_mobile_call_phone = helper.getView(R.id.iv_wallet_mobile_call_phone);

        tv_wallet_mobile.setOnClickListener(view -> {
            if (!TextUtils.isEmpty(item)) {
                if (mOnZHILevelDetailAdjuster != null) {
                    mOnZHILevelDetailAdjuster.OnItemClick(item);
                }
            }
        });

        iv_wallet_mobile_call_phone.setOnClickListener(view -> {
            if (!TextUtils.isEmpty(item)) {
                if (mOnZHILevelDetailAdjuster != null) {
                    mOnZHILevelDetailAdjuster.OnItemClick(item);
                }
            }
        });

        helper.getView(R.id.ll_content_bg).setOnClickListener(v -> {
            if (mOnZHILevelDetailAdjuster != null) {
                mOnZHILevelDetailAdjuster.OnItemClick(item);
            }
        });
    }

    public void setOnZHILevelDetailAdjusterItemClickListener(OnZHILevelWalletMobileAdjuster listener) {
        this.mOnZHILevelDetailAdjuster = listener;
    }

    public interface OnZHILevelWalletMobileAdjuster {
        void OnItemClick(String item);
    }
}
